﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ETADTools.Lib
{
  public class FormInfo
  {
    public RecordType RecordType { get; set; }
    public string TableName { get; set; }
    public string TableAlias { get; set; }
    public string PrimaryKey { get; set; }
    public string PageKey { get; set; }
    public FieldList FieldList { get; set; }
    public string PageName { get; set; }
    public string AuthorName { get; set; }
    public string CreationDate { get; set; }
    public string UpdaterPath { get; set; }

    public FormInfo(RecordType recordType, string tableName, 
      FieldList fieldList, string pageName, string author, string updaterPath)
    {
      RecordType = recordType;
      TableName = Formatter.FormatTableName(tableName);
      TableAlias = Converter.TableNameToTableAlias(tableName);
      PrimaryKey = Converter.TableNameToPrimaryKey(tableName);
      PageKey = Converter.RecordTypeToPageKey(RecordType);
      FieldList = fieldList;
      PageName = Formatter.FormatPageName(pageName);
      AuthorName = author;
      CreationDate = DateTime.Today.ToString("dd-MMM-yyyy"); // get creation date

      UpdaterPath = updaterPath;
    }
  }
}
